package models
{
    import codes.SocketCodes;

    import com.netease.protobuf.Int64;

    import kernel.core.Core;
    import kernel.events.ServerEvent;
    import kernel.mvc.BaseModel;

    import proto.client.SSC100012;
    import proto.client.SceneID;

    public class RoomModel extends BaseModel
    {
        private static var _ins:RoomModel;

		private var _adminType:int;
		private var _memberType:int;
        private var _roomId:Int64;
        private var _name:String;
        private var _desc:String;
        private var _senceID:int;

        private var _scene:SceneID;

//		optional int64 roomId = 1; //房间
//		optional string name = 3;
//		optional string desc = 4;
//		optional int32 scnenId = 5;

        public function RoomModel()
        {
            _ins = this;
            Core.modelObsServer.addEventListener (SocketCodes.S_0x100012 , onS_0x100012);
        }

		public function get memberType():int
		{
			return _memberType;
		}

		public function set memberType(value:int):void
		{
			_memberType = value;
		}

		public function get adminType():int
		{
			return _adminType;
		}

		public function set adminType(value:int):void
		{
			_adminType = value;
		}

        public function set roomId(value:Int64):void
        {
            _roomId = value;
        }

        public function get senceID():int
        {
            return _senceID;
        }

        public function get desc():String
        {
            return _desc;
        }

        public function get name():String
        {
            return _name;
        }

        public function get roomId():Int64
        {
            if (_roomId == null || _roomId.equals (0))
            {
                throw Error ("roomId无效");
            }
            return _roomId;
        }

        public static function get ins():RoomModel
        {
            return _ins;
        }

        private function onS_0x100012(event:ServerEvent):void
        {
            var vo:SSC100012 = event.createMessage (SSC100012) as SSC100012;
            _roomId = vo.roomId;
            _name = vo.name;
            _desc = vo.desc;
            _senceID = vo.scnenId;
			
        }

        public function get scene():SceneID
        {
            return _scene;
        }

        public function set scene(value:SceneID):void
        {
            _scene = value;
        }


    }
}
